package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    List<ShoppingCart> list(ShoppingCart shoppingCart);

    @Update("UPDATE shopping_cart SET number=#{number} WHERE id=#{id}")
    void update(ShoppingCart shoppingCart);

    void insert(ShoppingCart shoppingCart);

    @Delete("delete from shopping_cart where user_id=#{currentId}")
    void clean(Long currentId);

    @Delete("delete from shopping_cart where id=#{id}")
    void delete(Long id);

    @Update("UPDATE shopping_cart SET number=#{number} WHERE dish_id=#{dishId}")
    void deleteByDishId(ShoppingCart shoppingCart);
    @Update("UPDATE shopping_cart SET number=#{number} WHERE setmeal_id=#{setmealId}")
    void deleteSetmealId(ShoppingCart shoppingCart);


    void insertBatch(List<ShoppingCart> shoppingCartList);
}
